package ch4.object;

public class TestEquals {
	public static void main(String[] args) {
		Cat c1 = new Cat();
		c1.color =  1;
		c1.height = 10;
		c1.weight = 500;
		
		Cat c2 = new Cat();
		c2.color =  1;
		c2.height = 10;
		c2.weight = 500;
		
		System.out.println(c1.equals(c2));
	}
}

class Cat{
	int color;
	int height, weight;
	
	public boolean equals(Object obj) {
		if(obj == null)
			return false;
		if(obj instanceof Cat) {
			Cat c = (Cat)obj;
			if(c.color == this.color && c.height == this.height && c.weight == this.weight)
				return true;
		}
		return false;
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	//public boolean equals(Object obj) {
		/*if(obj == null) return false;
		
		if(obj instanceof Cat) {
			Cat c = (Cat)obj;
			if(c.color == this.color 
					&& c.height == this.height 
					&& c.weight == this.weight)
				return true;
		}
		return false;*/
		//return true;
	//}
}
